package com.zhss.eshop.membership.mapper;

import com.zhss.eshop.membership.domain.model.MembershipMemberPoint;
import org.apache.ibatis.annotations.*;

@Mapper
public interface MembershipMemberPointMapper {
    int deleteByPrimaryKey(Long id);

    int insertSelective(MembershipMemberPoint record);

    MembershipMemberPoint selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(MembershipMemberPoint record);

    /**
     * 根据用户账号id查询会员积分
     * @param userAccountId 用户账号id
     * @return 会员积分
     */
    @Select("SELECT "
            + "id,"
            + "user_account_id,"
            + "point,"
            + "gmt_create,"
            + "gmt_modified "
            + "FROM membership_member_point "
            + "WHERE user_account_id=#{userAccountId}")
    @Results({
            @Result(column = "id", property = "id", id = true),
            @Result(column = "user_account_id", property = "userAccountId"),
            @Result(column = "point", property = "point"),
            @Result(column = "gmt_create", property = "gmtCreate"),
            @Result(column = "gmt_modified", property = "gmtModified")
    })
    MembershipMemberPoint getByUserAccountId(@Param("userAccountId") Long userAccountId);
}
